# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=openapi-diff
pkgver=2.0.1
pkgrel=2
pkgdesc=" Utility for comparing two OpenAPI specifications"
arch=('any')
url="https://github.com/OpenAPITools/openapi-diff"
license=(Apache)
depends=(
  bash
  java-runtime=8
)
makedepends=(
  maven
  java-environment=8
)
source=(
  $url/archive/$pkgver/$pkgname-$pkgver.tar.gz
  $pkgname.sh
)
sha512sums=('2a343d8d2df7506e9cb97859b4396f98ca67c7d6e33cb44dcaa8cb6c8e6923ca6b844a54dacbab24ff3bf952e37b303d207da69124e68ab874262e34a2795f00'
            'e4143cff09abc59958f50a969ed3f010ab39e640cf77081e47e77cf3e2bb785645100572fd18bc508ea441732bc13a5a811332fdbfdbd7f8a0d6865f301f978e')
b2sums=('14b4b83dd766073fb100c66d816c7f0428d166c08e2fee24f5e6e63ed69a675a14361032a5e6f8681f4b8ca5434c560a8b8683bb925846a8aa5c18513a3e29ed'
        'a28a194b1b5c731fd3093c22754fc7f6641441ae2acb1ad177b8ee573d8e3787af2b249740ffd1e3472f721e0274d0866c0acf1bf5c85f4a22fe1c2dcf24af7b')

build() {
  cd $pkgname-$pkgver
  mvn clean install
}

package() {
  cd $pkgname-$pkgver
  install -vDm 644  cli/target/openapi-diff-cli-$pkgver-all.jar "$pkgdir/usr/share/java/$pkgname/$pkgname-cli.jar"
  install -vDm 755 ../$pkgname.sh "$pkgdir/usr/bin/$pkgname"
  ln -svf $pkgname "$pkgdir/usr/bin/$pkgname-cli"
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
